/**
 * Created by liu on 16-3-1.
 */
function get_free_data() {
    var url = '/cart/ajax_free_goods';
    var item;
    var success = function (data) {
        item = data;
    };
    var error = function () {
        alert('传参失败')
    };
    get_ajax(url, success, error);
    return item
}

function free_goods_info() {
    var goods_count_info = {};
    get_free_data().forEach(function (good) {
        goods_count_info[good.name] = good.free_count
    });
    return goods_count_info;
}

function add_to_original_price() {
    get_cart_goods().forEach(function (goods) {
        if (goods.count / free_goods_info()[goods.name] > 0) $('#' + goods.name + 'control').append("<div class='div'>(原价:&nbsp;&nbsp;<div class='div' id='" + goods.name + "list'>" + goods.count * goods.price + "</div>元)</div>")
    });
}
